"""
使用函数求素数和
"""
import math
def prime(p):
    flag = False
    for i in range(2, int(math.sqrt(p)) + 1):
        if p % i == 0:
            break
    else:
        if p >= 2:
            flag = True
    return flag

def PrimeSum(m, n):
    sum1= 0
    for i in range(m, n + 1):
        if prime(i):
            sum1 += i
    return sum1


m,n=input().split()
m=int(m)
n=int(n)
print(PrimeSum(m,n))